/*
 * AccountInfo.java
 * 
 * Stores all  information required to describe a licence account.
 * 
 * 
 * Copyright (C) 2008 Fraunhofer SCAI, Germany
 * All rights reserved
 * 
 * https://gforge.beingrid.eu/gf/project/scailm
 */
package de.fraunhofer.scai.lm.gui;

import java.util.ArrayList;
import java.util.List;

import org.apache.log4j.Logger;


/**
 * Stores all information required to describe a licence account.
 * 
 * @author Yona Raekow
 */
public class Account {

    /**
     * This is the number of the TANList currently in use.
     */
    private Integer myTANListNumber;

    /**
     * This is the number of TANs in the current TANList.
     */
    private Integer myNumberOfTANs;

    /**
     * The number of TANs that are currently unused.
     */
    private Integer myUnusedTANs;

    /**
     * The CPU hours that have been used by this licence account.
     */
    private Integer myCPUHours;

    /**
     * Information whether the current TANList is blocked or unblocked.
     */
    private Boolean myIsBlocked;

    
    /**
     * Contains further details on the licence account.
     */
    private List<String> myFeatureUsageCostsList;

    /**
     * The name of the licence account.
     */
    private String myAccountName;


    private double myTotalCosts;

    /**
     * Generates an account.
     * 
     * @param newAccountName
     * TODO: write docu
     * @param newTanListNumber
     * @param newNumberOfTans
     * @param newUnusedTans
     * @param newCPUHours
     * @param newIsBlocked
     * @param newDetails
     */
    
    /**
     * Logger for the Account class.
     */
    static Logger logger = Logger.getLogger(Account.class);

    public Account(String newAccountName, Integer newTanListNumber,
	    Integer newNumberOfTans, Integer newUnusedTans,
	    Integer newCPUHours, Boolean newIsBlocked,List<String> newFeatureUsageCostsList) {
		myAccountName = newAccountName;
		myTANListNumber = newTanListNumber;
		myNumberOfTANs = newNumberOfTans;
		myUnusedTANs = newUnusedTans;
		myCPUHours = newCPUHours;
		myIsBlocked = newIsBlocked;
		myFeatureUsageCostsList = newFeatureUsageCostsList;
		myTotalCosts = 0;
    	logger.debug("Constructor: Account with TanList has been generated");
    }

    /**
     * Generates an Account that has only a name and no TanList yet
     * 
     * @param newAccountName
     */
    public Account(String newAccountName) {
    	this(newAccountName, 0, null, null, null, true, null);
    	logger.debug("Constructor: Account that has only a name and no TanList yet has been generated");
    }

    /**
     * @return the TanListNumber
     */
    public Integer getTanListNumber() {
    	return myTANListNumber;
    }

    /**
     * @return the number of Tans in the TanList
     */
    public Integer getNumberOfTans() {
    	return myNumberOfTANs;
    }

    /**
     * @return the number of unused Tans
     */
    public Integer getUnusedTans() {
    	return myUnusedTANs;
    }

    /**
     * @return the CPUHours that the account used
     */
    public Integer getCPUHours() {
    	return myCPUHours;
    }

    /**
     * @return Further details of the license account
     */
    public List<String> getFeatureUsageCostsList() {
    	return myFeatureUsageCostsList;
    }
 

    /**
     * @return true if the account is blocked, false otherwise
     */
    public Boolean isBlocked() {
    	return myIsBlocked;
    }

    /**
     * Increase the TanListNumber by 1
     */
    public void increaseTanListNumber() {
    	myTANListNumber++;
    }

    /**
     * Reset the CPUHours to 0
     */
    public void resetCPUHours() {
    	myCPUHours = 0;
    }

    /**
     * Set the TANList to be blocked
     * 
     * @param newIsBlocked
     *                true if the TANList is blocked, false otherwise.
     */
    public void setIsBlocked(Boolean newIsBlocked) {
    	myIsBlocked = newIsBlocked;
    }

    /**
     * Set the number of TANs
     * 
     * @param newNumberOfTANs
     *                the number of TANs in the TAN list
     */
    public void setNumberOfTans(Integer newNumberOfTANs) {
    	myNumberOfTANs = newNumberOfTANs;
    }

    /**
     * Set the number of TANs that have not been used yet.
     * 
     * @param newUnusedTans
     *                the number of unused TANs in the list
     */
    public void setUnusedTans(Integer newUnusedTans) {
    	myUnusedTANs = newUnusedTans;
    }

    /**
     * Set other details that the user might want to know about the account.
     * 
     * @param newDetails
     *                a list of details that belong to the licence account
     */
    public void setDetails(ArrayList<String> newFeatureUsageCostsList) {
    	myFeatureUsageCostsList = newFeatureUsageCostsList;
    }

    /**
     * Obtain the account name.
     * 
     * @return the name of the account
     */
    public String getAccountName() {
    	return myAccountName;
    }

	public double getTotalCosts() {
		// TODO Auto-generated method stub
		return myTotalCosts;
	}

	public void setTotalCosts(double newTotalCosts) {
		myTotalCosts = newTotalCosts;
		
	}

}
